<template>
	<view>
		<view class="flex">
			<u-avatar :src="item.avatar||''" size="92"></u-avatar>
			<view class="flex1 pl24">
				<view class="fs30 fw-700">{{item.name}}</view>
				<view class="fs26 color-999 mt12">{{item.add_time}}</view>
			</view>
			<image :src="types_img[item.type]" class="w40 h40" mode="" />
			<view class="ml10 mr10 color-666">{{types[item.type]}}</view>
		</view>
		<view class="fs28 color-666 mt24 lh15">{{item.content}}</view>
		<view class="h20"></view>
		<z-imgs :paths="item.images" look margin="20" radius="10" />
		<view class="mt32 p20 bg-f8f radius12" v-if="item.reply">
			<text class="color-zs">回复：</text>
			<text class="">{{item.reply}}</text>
		</view>
		<block v-if="reply">
			<!-- <view class="flex row-right mt20" v-if="!item.reply">
				<view class="">
					<u-button size="mini" type="warning" @click="item_data=item,$refs.modal.open()">回复</u-button>
				</view>
			</view>
			<modal ref="modal" type="textarea" title="回复" @confirm="replyComment" /> -->
		</block>
	</view>
</template>

<script>
	export default {
		name: "comment",
		props: {
			item: {
				default: ''
			},
			reply: {
				type: Boolean,
				default: false
			},
		},
		data() {
			return {
				types: {
					good: '好评',
					medium: '中评',
					bad: '差评',
				},
				types_img: {
					good: '/static/img/my/ev1.png',
					medium: '/static/img/my/ev2.png',
					bad: '/static/img/my/ev3.png',
				},
			};
		},
		methods: {
			replyComment(reply) {
				this.$request('/member/my/replyComment', {
					comment_id: this.item.id,
					reply,
				}).then(res => {
					this.$msg(res.msg)
					this.item.reply = reply
					this.$refs.modal.cancel()
				})
			}
		}
	}
</script>

<style lang="scss">

</style>